package com.youtellv1.service.Impl;

import com.youtellv1.dto.GSalDTO;
import com.youtellv1.entity.GSal;
import com.youtellv1.mapper.GSalMapper;
import com.youtellv1.service.GSalService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;

@Service
public class GSalServiceImpl implements GSalService {
    @Resource
    private GSalMapper gsalMapper;

    @Override
    public int countByTid(Integer tid) {
        return gsalMapper.countByTid(tid);
    }

    @Override
    public List<GSalDTO> findByTidWithPage(Integer tid, int page, int size) {
        int offset = (page - 1) * size;
        return gsalMapper.findByTidWithPage(tid, offset, size);
    }

    @Override
    public void insert(GSalDTO gsaldto) {
        gsalMapper.insert(gsaldto);
    }

    @Override
    public void updateService(GSalDTO gSalDTO) {
        gsalMapper.update(gSalDTO);
    }

    @Override
    public void deleteService(Integer sid) {
        gsalMapper.delete(sid);
    }


    @Override
    public GSal findById(Integer sid) {
        return gsalMapper.findById(sid);
    }
}
